<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
    <title>ShellCheck: SC1018 – This is a unicode non-breaking space. Delete it and retype as space.</title>
    <link rel="stylesheet" href="css/bootstrap.min.css" />
  </head>
  <body style="margin-left: auto; margin-right: auto; max-width: 800px">
    <h1>SC1018 – ShellCheck Wiki</h1>
    <a href="https://github.com/koalaman/shellcheck/wiki/SC1018">See this page on GitHub</a>
    <p style="display: none"><a href="index.html">Sitemap</a></p>
    <hr />
    <h1
id="this-is-a-unicode-non-breaking-space-delete-it-and-retype-as-space">This
is a unicode non-breaking space. Delete it and retype as space.</h1>
<p>You copy-pasted some code, probably from a blog or web site, which
for formatting reasons contained Unicode no-break spaces or Unicode
zero-width spaces instead of regular spaces or in words.</p>
<p>To humans, a zero-width space is invisible and a non-breaking space
is indistinguishable from a regular space, but the shell does not
agree.</p>
<p>If you have just a few, delete the indicated space/word and retype
it. If you have tons, do a search-and-replace in your editor (copy-paste
an offending space into the search field, and type a regular space into
the replace field), or use the following command to remove them:</p>
<div class="sourceCode" id="cb1"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb1-1"><a href="SC1018.html#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="fu">sed</span> <span class="at">-e</span> <span class="st">$&#39;s/</span><span class="dt">\xC2\xA0</span><span class="st">/ /g&#39;</span> <span class="at">-e</span> <span class="st">$&#39;s/</span><span class="dt">\xE2\x80\x8b</span><span class="st">//g&#39;</span> <span class="at">-i</span> yourfile</span></code></pre></div>
<p>On macOS, a non-breaking space can be inserted into most programs by
holding <kbd>⌥ Option</kbd>+<kbd>Space</kbd>.</p>
    <hr />
    <p style='font-size: 80%'><a href="../index.html">ShellCheck</a> is a static analysis tool for shell scripts. This page is part of its documentation.</p>
  </body>
</html>


